<?php
/**
 * Created by PhpStorm.
 * User: Hongjw
 * Date: 2018/3/17
 * Time: 17:56
 */

/**
 * 返回枚举信息
 *
 * @param $typeName
 * @param string $key
 * @param string $fileName
 * @return mixed
 */
function getEnumName($typeName, $key, $fileName = 'Enum')
{
    $str = 'Enum.' . trim($fileName) . '.' . $typeName;
    $data = config($str);
    $key = (string)$key;
    if (!isset($data[$key])) {
        return '';
    } else {
        return $data[$key];
    }
}

/**
 * 返回配置数组
 *
 * @param $typeName
 * @param string $fileName
 * @return array
 */
function getEnumArr($typeName, $fileName = 'Enum')
{
    $str = 'Enum.' . trim($fileName) . '.' . $typeName;
    $data = config($str);
    return $data;
}